package com.example.vip1.zerenlian2;

import java.util.ArrayList;
import java.util.List;

/**
 * *******************************************************
 * Author: chinadragon
 * Time: 8/18/21 10:01 PM
 * Name:
 * Overview:
 * Usage:
 * *******************************************************
 */
public class ChainManager implements IBaskTask {
    private List<IBaskTask> mIBaskTaskList = new ArrayList<>();

    public void addTask(IBaskTask iBaskTask) {
        mIBaskTaskList.add(iBaskTask);
    }

    private int index = 0;

    @Override
    public void doAction(String isTask, IBaskTask iBaskTask) {
        if (mIBaskTaskList.isEmpty() || index >= mIBaskTaskList.size()) {
            return;
        }

        IBaskTask task = mIBaskTaskList.get(index);
        index++;
        task.doAction(isTask,iBaskTask);

    }
}
